package com.wdciti.sccp.iot.springvertx.configure;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;

/**
 * @author by early
 */
@Slf4j
@Data
@Configuration
@ConfigurationProperties(prefix = "vertx.exclude")
public class VerticleExclude {
    private static final String CUT = ":";
    private List<String> fullNames = new ArrayList<>();

    public boolean isExclude(String name) {
        if (!name.contains(CUT)) {
            log.warn("Exclude verticle({}) is NOT fullName! please check config!", name);
            return false;
        }
        return fullNames.contains(name);
    }
}
